import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { Role } from "@/modules/system/role/entities/role.entity";
import { Api } from "@/modules/system/api/entities/api.entity";

@Entity({name:"yh_sys_role_api"})
export class RoleApi {
    @PrimaryGeneratedColumn()
    id: number;
    
    @Column({ type: "int", name: "roleId", comment: "角色 id" })
    roleId: number;
    
    @Column({ type: "int", name: "apiId", comment: "api id" })
    apiId: number;
    
    @ManyToOne(() => Api, (api) => api.id, { onDelete: "CASCADE" })
    api: Api;
    
    @ManyToOne(() => Role, (role) => role.id, { onDelete: "CASCADE" })
    role: Role;
}
